using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Omes.Model;
using Omes.Services;

namespace FashionMural.Web
{
    public partial class Contact : System.Web.UI.Page
    {
        public List<Omes.Model.QuestionNaire> SingleQuesitons { get; set; }

        public List<Omes.Model.QuestionNaire> MultiQuestions { get; set; }

        public List<Omes.Model.QuestionNaire> SelfQuestions { get; set; }

        public string JSSingles
        {
            get { return Omes.Services.Serializer.JsonSerializer<List<QuestionNaire>>(SingleQuesitons); }
        }

        public string JSMuls
        {
            get { return Omes.Services.Serializer.JsonSerializer<List<QuestionNaire>>(MultiQuestions); }
        }

        public string JSSelf
        {
            get { return Omes.Services.Serializer.JsonSerializer<List<QuestionNaire>>(SelfQuestions); }
        }

        //protected int CurrentPageNum { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            Omes.Services.DbServer db = new DbServer();
            List<Omes.Model.QuestionNaire> allQuestions = db.GetAllQuestionNaires();
            SingleQuesitons = allQuestions.Where(t => (t.Type == 1)).ToList();
            MultiQuestions = allQuestions.Where(t => (t.Type == 2)).ToList();
            SelfQuestions = allQuestions.Where(t => (t.Type == 3)).ToList();
        }

        public List<Omes.Model.QuestionNaireAnswer> GetAnswers(int questionId)
        {
            List<Omes.Model.QuestionNaireAnswer> reuslt = new List<QuestionNaireAnswer>();
            DbServer db = new DbServer();
            reuslt = db.GetQuestionNarieAnswerUseQuestionId(questionId);
            return reuslt;
        }
    }
}